﻿using Abp.Application.Navigation;
using Abp.Localization;
using FwProject.Authorization;

namespace FwProject.Web.Startup
{
    /// <summary>
    /// This class defines menus for the application.
    /// </summary>
    public class FwProjectNavigationProvider : NavigationProvider
    {
        public override void SetNavigation(INavigationProviderContext context)
        {
            context.Manager.MainMenu
                .AddItem(
                    new MenuItemDefinition(
                        PageNames.Users,
                        L("用户管理"),
                        url: "/Users/Index",
                        icon: "glyphicon glyphicon-user",
                        requiredPermissionName: PermissionNames.User_Index
                    //requiredPermissionName: PermissionNames.Pages_Users
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Roles,
                        L("角色权限"),
                        url: "Roles",
                        icon: "glyphicon glyphicon-cog",
                        requiredPermissionName: PermissionNames.Pages_Roles
                    //requiredPermissionName: PermissionNames.Pages_Roles
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Factory,
                        L("工厂管理"),
                        icon: "glyphicon glyphicon-star-empty"
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Factory,
                        L("工厂列表"),
                        url: "Factory",
                        icon: "glyphicon glyphicon-compressed",
                        requiredPermissionName: PermissionNames.Factory_Index
                    )
                    ).AddItem(
                        new MenuItemDefinition(
                        PageNames.RestaurantByFactory,
                        L("分配所属工厂"),
                        url: "/Restaurant/Factory",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true,
                        requiredPermissionName: PermissionNames.Factory_Index
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Restaurant,
                        L("餐厅管理"),
                        icon: "glyphicon glyphicon-cutlery",
                        requiresAuthentication: true
                    ).AddItem(
                        new MenuItemDefinition(
                        PageNames.Restaurant,
                        L("餐厅列表"),
                        url: "Restaurant",
                        icon: "glyphicon glyphicon-star",
                        requiredPermissionName: PermissionNames.Restaurant_Index
                        )
                    ).AddItem(
                        new MenuItemDefinition(
                        "RestaurantNewAdd",
                        L("餐厅新增统计"),
                        url: "/Restaurant/RestaurantNewAdd",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                        new MenuItemDefinition(
                        "RestaurantDiscontinue",
                        L("餐厅停用统计"),
                        url: "/Restaurant/Discontinuation",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                        new MenuItemDefinition(
                        PageNames.Restaurant,
                        L("餐厅分布"),
                        url: "/Restaurant/Distributed",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    )
                  ).AddItem(
                    new MenuItemDefinition(
                        PageNames.TypeNumber,
                        L("货品管理"),
                        url: "TypeNumber",
                        icon: "glyphicon glyphicon-pushpin",
                        requiredPermissionName: PermissionNames.TypeNumber_Index
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Car,
                        L("汽车管理"),
                        url: "Car",
                        icon: "glyphicon glyphicon-random",
                        requiredPermissionName: PermissionNames.Car_Index
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        "DistributionLine",
                        L("配送线路管理"),
                        icon: "glyphicon glyphicon-transfer",
                        requiresAuthentication: true
                    //requiredPermissionName: PermissionNames.Car_Index
                    ).AddItem(
                        new MenuItemDefinition(
                            "DistributionLine",
                            L("配送线路"),
                            url: "/DistributionLine/Index",
                            icon: "glyphicon glyphicon-transfer",
                            requiresAuthentication: true
                        //requiredPermissionName: PermissionNames.Car_Index
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        "DistributionLine",
                        L("司机绑定线路"),
                        url: "/DriverLine/Index",
                        icon: "glyphicon glyphicon-transfer",
                        requiresAuthentication: true
                        //requiredPermissionName: PermissionNames.Car_Index
                        )
                    )
                )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionManagement,
                        L("配送管理"),
                        icon: "glyphicon glyphicon-road",
                        requiredPermissionName: PermissionNames.Distribution
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionManagement,
                        L("装车"),
                        icon: "glyphicon glyphicon-inbox",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Loading
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Car,
                        L("装车单"),
                        url: "/Distribution/LoadingInvoice",
                        icon: "glyphicon glyphicon-star",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Loading
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Car,
                        L("装车货品明细"),
                        url: "/Distribution/LoadingDetails",
                        icon: "glyphicon glyphicon-star",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Loading
                    )
                )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Distribution,
                        L("配送"),
                        icon: "glyphicon glyphicon-random",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Distribution
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Distribution,
                        L("配送列表"),
                        icon: "glyphicon glyphicon-star",
                        url: "/Distribution/DistributionIndex",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Distribution
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionDetails,
                        L("配送单"),
                        icon: "glyphicon glyphicon-star",
                        url: "/Distribution/DistributionDetails",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Distribution
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        "DistributionCreate",
                        L("加单/补录"),
                        icon: "glyphicon glyphicon-star",
                        url: "/Distribution/AddDistribution",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Distribution
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionSign,
                        L("配送签收"),
                        icon: "glyphicon glyphicon-star",
                        url: "/Distribution/SignIndex",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Distribution
                        )
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送报表"),
                        icon: "glyphicon glyphicon-equalizer",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Report
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("餐厅配送统计"),
                        url: "/DistributionReport/RestaurantDistribution",
                        icon: "glyphicon glyphicon-th",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("司机配送统计"),
                        url: "/DistributionReport/DriverDistribution",
                        icon: "glyphicon glyphicon-th",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送商品统计"),
                        icon: "glyphicon glyphicon-th",
                        url: "/DistributionReport/DistributionStatistics",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送情况统计"),
                        icon: "glyphicon glyphicon-th",
                        url: "/DistributionReport/DeliverySituation",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        "DistributionLineReport",
                        L("线路配送统计"),
                        icon: "glyphicon glyphicon-th",
                        url: "/DistributionReport/DistributionLine",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("当季汇总"),
                        icon: "glyphicon glyphicon-th",
                        url: "/DistributionReport/QuarterlySummary",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送差件汇总"),
                        icon: "glyphicon glyphicon-th",
                        url: "/DistributionReport/DistributionDiff",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("司机实送率统计"),
                        icon: "glyphicon glyphicon-th",
                        url: "/DistributionReport/DriverActualRatio",
                        requiresAuthentication: true
                        )
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送图形报表"),
                        icon: "glyphicon glyphicon-stats",
                        requiredPermissionName: PermissionNames.Distribution_Menu_GraphicReport
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("月配送总报表"),
                        url: "/DistributionReport/MonthDistributionReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("年配送总报表"),
                        url: "/DistributionReport/YearDistributionReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("型号月配送图"),
                        url: "/DistributionReport/MonthTypeReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("型号年配送图"),
                        url: "/DistributionReport/YearTypeReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("司机月配送图"),
                        url: "/DistributionReport/MonthDriverReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("司机年配送图"),
                        url: "/DistributionReport/YearDriverReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送与回收(按天)"),
                        url: "/DistributionReport/DistributionAndRecyclingReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送与回收(按月)"),
                        url: "/DistributionReport/DistributionAndRecyclingMonthReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.DistributionReport,
                        L("配送与回收(司机)"),
                        url: "/DistributionReport/DistributionAndRecyclingByDriverReportChart",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    )
                ).AddItem(
                    new MenuItemDefinition(
                        "RestaurantStock",
                        L("餐厅店存"),
                        icon: "glyphicon glyphicon-list-alt",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Store
                    ).AddItem(
                        new MenuItemDefinition(
                            "RestaurantStock",
                            L("店存统计"),
                            url: "Restaurant/RestaurantStock",
                            icon: "glyphicon glyphicon-th",
                            requiresAuthentication: true
                        )
                    ).AddItem(
                        new MenuItemDefinition(
                            "",
                            L("盘点"),
                            url: "Restaurant/RestaurantStockCheck",
                            icon: "glyphicon glyphicon-edit",
                            requiresAuthentication: true
                        )
                    ).AddItem(
                        new MenuItemDefinition(
                            "",
                            L("盘点单"),
                            url: "StockCheck/Index",
                            icon: "glyphicon glyphicon-list-alt",
                            requiresAuthentication: true
                        )
                    )
               ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Car,
                        L("车辆监控"),
                        icon: "glyphicon glyphicon-screenshot",
                        requiredPermissionName: PermissionNames.Distribution_Menu_Monitor
                    ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Car,
                        L("配送轨迹"),
                        url: "/Distribution/Track",
                        icon: "glyphicon glyphicon-star",
                        requiresAuthentication: true
                        )
                    )
                )
                ).AddItem(
                    new MenuItemDefinition(
                        PageNames.Finance,
                        L("财务管理"),
                        icon: "glyphicon glyphicon-briefcase",
                        requiredPermissionName: PermissionNames.Finance
                        ).AddItem(
                            new MenuItemDefinition(
                                PageNames.Receivable,
                                L("应收"),
                                icon: "glyphicon glyphicon-jpy",
                                requiredPermissionName: PermissionNames.Finance_Menu_Receivable
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.ReceivableList,
                                    L("制作收据"),
                                    url: "/Receivable/MakingReceipt",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.ReceivableList,
                                    L("收据查询"),
                                    url: "/Settlement/Index",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.ReceivableList,
                                    L("分配收据"),
                                    url: "/Settlement/AssignReceipt",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.ReceivableList,
                                    L("应收查询"),
                                    url: "/Receivable/Index",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.ReceivableList,
                                    L("应收汇总表"),
                                    url: "/Receivable/Summary",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.ReceivableList,
                                    L("未制作收据餐厅"),
                                    url: "/Receivable/NotMadeReceipt",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            )
                        ).AddItem(
                            new MenuItemDefinition(
                                PageNames.Settlemnet,
                                L("收款"),
                                icon: "glyphicon glyphicon-credit-card",
                                requiredPermissionName: PermissionNames.Finance_Menu_Receipt
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.SettlemnetList,
                                    L("快速收款"),
                                    url: "/Receipt/FastlyReceipt",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                    PageNames.SettlemnetList,
                                    L("收款单"),
                                    url: "/Receipt/Index",
                                    icon: "glyphicon glyphicon-list",
                                    requiresAuthentication: true
                                )
                            )
                        ).AddItem(
                                new MenuItemDefinition(
                                    "StaySettlement",
                                    L("预收款"),
                                    icon: "glyphicon glyphicon-credit-card",
                                    requiredPermissionName: PermissionNames.Finance_Menu_Preparatory
                                ).AddItem(
                                    new MenuItemDefinition(
                                        PageNames.SettlemnetList,
                                        L("预收款单"),
                                        url: "/Settlement/AdvancePayment",
                                        icon: "glyphicon glyphicon-list",
                                        requiresAuthentication: true
                                    )
                                ).AddItem(
                                    new MenuItemDefinition(
                                        PageNames.SettlemnetList,
                                        L("退还预收款"),
                                        url: "/Settlement/RefundPayment",
                                        icon: "glyphicon glyphicon-list",
                                        requiresAuthentication: true
                                    )
                                ).AddItem(
                                    new MenuItemDefinition(
                                        PageNames.SettlemnetList,
                                        L("预收款余额"),
                                        url: "/Settlement/AdvanceOverage",
                                        icon: "glyphicon glyphicon-list",
                                        requiresAuthentication: true
                                    )
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                "Payment",
                                L("缴款"),
                                icon: "glyphicon glyphicon-usd",
                                requiredPermissionName: PermissionNames.Finance_Menu_Payment
                              ).AddItem(
                                    new MenuItemDefinition(
                                    "Payment",
                                    L("缴款"),
                                    url: "/Payment/PaymentIndex",
                                    icon: "glyphicon glyphicon-usd",
                                    requiresAuthentication: true
                                  )
                              ).AddItem(
                                    new MenuItemDefinition(
                                    "PaymentVoucher",
                                    L("缴款凭证"),
                                    url: "/Payment/Index",
                                    icon: "glyphicon glyphicon-usd",
                                    requiresAuthentication: true
                                  )
                              )
                            ).AddItem(
                            new MenuItemDefinition(
                            "Deposit",
                            L("押金"),
                            icon: "glyphicon glyphicon-usd",
                            requiredPermissionName: PermissionNames.Finance_Menu_Deposit
                            ).AddItem(
                                new MenuItemDefinition(
                                "Deposit",
                                L("收押金"),
                                url: "/Deposit/CollectDeposit",
                                icon: "glyphicon glyphicon-usd",
                                requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                "Deposit",
                                L("退押金"),
                                url: "/Deposit/ReturnDeposit",
                                icon: "glyphicon glyphicon-usd",
                                requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                "Deposit",
                                L("押金统计"),
                                url: "/Deposit/DepositStatistics",
                                icon: "glyphicon glyphicon-usd",
                                requiresAuthentication: true
                                )
                           )//.AddItem(
                            //     new MenuItemDefinition(
                            //     "Deposit",
                            //     L("收退统计"),
                            //     url: "/Deposit/CollectAndReturnDeposit",
                            //     icon: "glyphicon glyphicon-usd",
                            //     requiresAuthentication: true
                            //     )
                            //)
                        ).AddItem(
                            new MenuItemDefinition(
                            "FinanceReport",
                            L("财务报表"),
                            icon: "glyphicon glyphicon-equalizer",
                            requiresAuthentication: true
                            ).AddItem(
                                new MenuItemDefinition(
                                "FinanceReport",
                                L("资金池"),
                                url: "/FinanceReport/CapitalPool",
                                icon: "glyphicon glyphicon-equalizer",
                                requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                "FinanceReport",
                                L("未收款客户一览表"),
                                url: "/FinanceReport/NotReceivable",
                                icon: "glyphicon glyphicon-equalizer",
                                requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                "FinanceReport",
                                L("客户往来流水账"),
                                url: "/FinanceReport/RunningAccount",
                                icon: "glyphicon glyphicon-equalizer",
                                requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                "FinanceReport",
                                L("每日收支汇总"),
                                url: "/FinanceReport/DailyIncomeAndExpenses",
                                icon: "glyphicon glyphicon-equalizer",
                                requiresAuthentication: true
                                )
                            ).AddItem(
                                new MenuItemDefinition(
                                "FinanceReport",
                                L("财务汇总报表"),
                                url: "/FinanceReport/FinanceSummary",
                                icon: "glyphicon glyphicon-equalizer",
                                requiresAuthentication: true
                            )
                        ).AddItem(
                                new MenuItemDefinition(
                                "FinanceReport",
                                L("结算账户收知明细"),
                                url: "/FinanceReport/SettleAccountsKnowingDetail",
                                icon: "glyphicon glyphicon-equalizer",
                                requiresAuthentication: true
                            )
                        ).AddItem(
                                new MenuItemDefinition(
                                "FinanceReport",
                                L("应收对账单"),
                                url: "/FinanceReport/ReceivableStatement",
                                icon: "glyphicon glyphicon-equalizer",
                                requiresAuthentication: true
                            )
                        )
                        ).AddItem(
                            new MenuItemDefinition(
                            "StatementAccount",
                            L("对账单"),
                            url: "/Restaurant/StatementAccount",
                            icon: "glyphicon glyphicon-check",
                            requiredPermissionName: PermissionNames.Finance_Menu_Statement
                            )
                        ).AddItem(
                            new MenuItemDefinition(
                            "BasicInformation",
                            L("基础资料"),
                            icon: "glyphicon glyphicon-check",
                           requiredPermissionName: PermissionNames.Finance_Menu_Basic
                            ).AddItem(
                            new MenuItemDefinition(
                            "BasicInformation",
                            L("结算账户"),
                            url: "/Finance/SettlementAccount",
                            icon: "glyphicon glyphicon-check",
                            requiresAuthentication: true
                            )
                        )
                    )
                        )
                       .AddItem(
                        new MenuItemDefinition(
                            "SystemSetup",
                            L("系统设置"),
                            icon: "glyphicon glyphicon-briefcase",
                            requiresAuthentication: true
                        ).AddItem(
                            new MenuItemDefinition(
                                "SystemSetup",
                                L("公司管理"),
                                url: "/MConfig/Index",
                                icon: "glyphicon glyphicon-briefcase",
                                requiresAuthentication: true
                            )
                        ).AddItem(
                            new MenuItemDefinition(
                                "SystemSetup",
                                L("消息推送"),
                                url: "/Users/UserPushMessage",
                                icon: "glyphicon glyphicon-briefcase",
                                requiresAuthentication: true
                            )
                        )
                    );
        }

        private static ILocalizableString L(string name)
        {
            return new LocalizableString(name, FwProjectConsts.LocalizationSourceName);
        }
    }
}
